package ch.sv7.tool.classloader;

import java.io.File;
import java.net.URL;
import java.sql.Driver;

import junit.framework.TestCase;

/**
 * TODO: Document me!
 *
 * @author svt
 *
 */
public class ClassFinderTestCase extends TestCase {

	public void testClassFinder() throws Exception {
		URL url = this.getClass().getResource("/org/hsqldb");
		String path = url.getFile();
		path = path.substring(0, path.indexOf("!"));
		File hsqldbJarFile = new File(path.substring("file:".length()));
		assertTrue(hsqldbJarFile.exists());
		
		String[] classes = ClassFinder.getClassesImplementing(Driver.class, hsqldbJarFile.getAbsolutePath());
		assertNotNull(classes);
		
		assertTrue(classes.length > 0);
		System.out.println(classes[0]);
	}
}
